<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%String path=request.getContextPath();pageContext.setAttribute("path",path); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
	<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
	<script type="text/javascript">
	
			$.extend( $.mobile , {pageLoadErrorMessage: "未知错误！"});
			$(document).ready(function(){
				$("#changePage").change(function(){
					var url="${path}/question/listView.do?page="+$(":selected",this).val();
					$.mobile.changePage(url, "slideup");
				});
			});
			
	</script>
<title>问题列表</title>
</head>

<body>
	<div data-role="page" id="listView">
    <div data-theme="a" data-role="header">
        <h3>
            查看回答
        </h3>
       
    </div>
       <div data-role="content">
        <ul data-role="listview" data-divider-theme="" data-inset="true">
            <li data-role="list-divider" role="heading"> 问题列表 </li>
            
            <c:forEach items="${pager.list}" var="question">
	            <li data-theme="c">
	                <a href="${path}/question/details.do?id=${question.qid}" data-transition="slide">
	                    ${question.subject}
	                    <c:if test="${question.status eq 1 }">
	                    <span class="ui-li-count"> new </span>
	                    </c:if>
	                </a>
	            </li>
            </c:forEach>
        </ul>
		
		<table width="100%">
			<tr>
				<td>
					<a data-role="button" href="<%=path%>/question/listView.do?page=${pager.previousPage}" id="prev" >上一页</a>
				</td>
				<td>
				<select id="changePage" data-native-menu="false"  data-theme="a">
					<c:forEach begin="1" end="${pager.totalPages }"  var="page">
	                	<option value="${page}"  ${pager.page eq page ? "selected" : "" }>${page}</option>
					</c:forEach>
           		 </select>
				</td>
				<td>
					<a data-role="button" href="<%=path%>/question/listView.do?page=${pager.nextPage}" id="next">${page}下一页</a>
				</td>
			</tr>
		</table>
		<script type="text/javascript">
			$("select").selectmenu({theme:"a"});
			$("select").selectmenu("refresh"); 
		</script>
		
    </div>
    
    
    
   <jsp:include page="foot.jsp"/>
</div>

</body>
</html>
